<html>
<head>
    <title>iisnode logs</title>
    <style type="text/css">
        body
        {
            font-family: "Trebuchet MS" , Arial, Helvetica, sans-serif;
        }
        table
        {
            border-collapse: collapse;
        }
        td, th
        {
            border: 1px solid lightgray;
            padding: 3px 7px 2px 7px;
        }
        th
        {
            text-align: left;
            padding-top: 5px;
            padding-bottom: 4px;
            background-color: Gray;
            color: #ffffff;
        }
        td.stderr
        {
            color: Red;
        }
    </style>
</head>
<body>
    <table id="logFilesTable">
        <tr>
            <th>
                Computer name
            </th>
            <th>
                PID
            </th>
            <th>
                Type
            </th>
            <th>
                Created
            </th>
            <th>
                Link
            </th>
        </tr>
    </table>
    <p id="lastUpdated"></p>
    <script type="text/javascript">

        // this is replaced with actual data at runtime by code in interceptor.js
        var logFiles = [{"file":"AKUR-3404-stderr-1360514090763.txt","computername":"AKUR","pid":3404,"type":"stderr","created":1360514090763},{"file":"AKUR-4264-stderr-1360515341095.txt","computername":"AKUR","pid":4264,"type":"stderr","created":1360515341095},{"file":"AKUR-4352-stderr-1360512830670.txt","computername":"AKUR","pid":4352,"type":"stderr","created":1360512830670},{"file":"AKUR-5180-stderr-1360512998176.txt","computername":"AKUR","pid":5180,"type":"stderr","created":1360512998176},{"file":"AKUR-5620-stderr-1360513976688.txt","computername":"AKUR","pid":5620,"type":"stderr","created":1360513976688},{"file":"AKUR-5660-stderr-1360512830296.txt","computername":"AKUR","pid":5660,"type":"stderr","created":1360512830296},{"file":"AKUR-5888-stderr-1360513131283.txt","computername":"AKUR","pid":5888,"type":"stderr","created":1360513131283},{"file":"AKUR-6012-stderr-1360512795821.txt","computername":"AKUR","pid":6012,"type":"stderr","created":1360512795821},{"file":"AKUR-6120-stderr-1360513396665.txt","computername":"AKUR","pid":6120,"type":"stderr","created":1360513396665},{"file":"AKUR-6456-stderr-1360513659927.txt","computername":"AKUR","pid":6456,"type":"stderr","created":1360513659927},{"file":"AKUR-696-stderr-1360515450863.txt","computername":"AKUR","pid":696,"type":"stderr","created":1360515450863},{"file":"AKUR-7068-stderr-1360515154772.txt","computername":"AKUR","pid":7068,"type":"stderr","created":1360515154772},{"file":"AKUR-7292-stderr-1360513724459.txt","computername":"AKUR","pid":7292,"type":"stderr","created":1360513724459},{"file":"AKUR-7452-stderr-1360513532925.txt","computername":"AKUR","pid":7452,"type":"stderr","created":1360513532925},{"file":"AKUR-8088-stderr-1360512795415.txt","computername":"AKUR","pid":8088,"type":"stderr","created":1360512795415}];
        var lastUpdated = 1360515451530;
        var date = new Date();

        date.setTime(lastUpdated);
        document.getElementById('lastUpdated').innerHTML = 'Index was last updated ' + date;

        logFiles.sort(function (a, b) {
            return b.created - a.created;
        });

        var logFilesTable = document.getElementById("logFilesTable");
        for (var i = 0; i < logFiles.length; i++) {
            var logFile = logFiles[i];
            date.setTime(logFile.created);
            var row = logFilesTable.insertRow(-1);
            var computerNameCell = row.insertCell(0);
            var pidCell = row.insertCell(1);
            var typeCell = row.insertCell(2);
            var dateCell = row.insertCell(3);
            var logCell = row.insertCell(4);
            computerNameCell.innerHTML = logFile.computername;
            pidCell.innerHTML = logFile.pid.toString();
            typeCell.innerHTML = logFile.type;
            typeCell.setAttribute('class', logFile.type);
            dateCell.innerHTML = date.toString();
            logCell.innerHTML = '<a href="' + logFile.file + '">log</a>';
        };

    </script>
</body>
</html>
